//
//  RefreshStateAndLastTime.m
//  carcareIOS
//
//  Created by wr on 15/7/14.
//  Copyright (c) 2015年 baozun. All rights reserved.
//

#import "RefreshDeviceStatus.h"
#import "NetCar.h"



@implementation RefreshDeviceStatus

IMP_SINGLETON

-(instancetype)init
{
    self = [super init];
    if (self) {
        self.timeInterval = 60;
        __weak __typeof(self) wself = self;
        self.Refresh = ^(){
            [[NetCar getBindingDeviceState]requestSuccess:^(id JSON) {
                wself.state = [JSON[@"STATUS"] boolValue];
                wself.status = (wself.state ? @"设备正常" : @"设备异常");
                wself.lastUseDate = JSON[@"lastUseDate"];
                if (wself.RefreshCallBack) {
                    wself.RefreshCallBack(JSON);
                }
            } failure:^(id JSON) {
                
            }];
        };
    }
    return  self;
}

@end
